/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.vijayan.profile.service;

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.BaseModel;

import com.vijayan.profile.model.FamilyMemberClp;
import com.vijayan.profile.model.HoroscopeClp;
import com.vijayan.profile.model.MyExpectationClp;
import com.vijayan.profile.model.MyPhotoClp;
import com.vijayan.profile.model.ProfileClp;

import java.lang.reflect.Method;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Brian Wing Shun Chan
 */
public class ClpSerializer {
	public static final String SERVLET_CONTEXT_NAME = "profile-portlet";

	public static void setClassLoader(ClassLoader classLoader) {
		_classLoader = classLoader;
	}

	public static Object translateInput(BaseModel<?> oldModel) {
		Class<?> oldModelClass = oldModel.getClass();

		String oldModelClassName = oldModelClass.getName();

		if (oldModelClassName.equals(ProfileClp.class.getName())) {
			ProfileClp oldCplModel = (ProfileClp)oldModel;

			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					Class<?> newModelClass = Class.forName("com.vijayan.profile.model.impl.ProfileImpl",
							true, _classLoader);

					Object newModel = newModelClass.newInstance();

					Method method0 = newModelClass.getMethod("setProfileId",
							new Class[] { Long.TYPE });

					Long value0 = new Long(oldCplModel.getProfileId());

					method0.invoke(newModel, value0);

					Method method1 = newModelClass.getMethod("setProfileCode",
							new Class[] { String.class });

					String value1 = oldCplModel.getProfileCode();

					method1.invoke(newModel, value1);

					Method method2 = newModelClass.getMethod("setCreatedForMy",
							new Class[] { String.class });

					String value2 = oldCplModel.getCreatedForMy();

					method2.invoke(newModel, value2);

					Method method3 = newModelClass.getMethod("setProfileName",
							new Class[] { String.class });

					String value3 = oldCplModel.getProfileName();

					method3.invoke(newModel, value3);

					Method method4 = newModelClass.getMethod("setGender",
							new Class[] { Boolean.TYPE });

					Boolean value4 = new Boolean(oldCplModel.getGender());

					method4.invoke(newModel, value4);

					Method method5 = newModelClass.getMethod("setBirthDateWithTime",
							new Class[] { Date.class });

					Date value5 = oldCplModel.getBirthDateWithTime();

					method5.invoke(newModel, value5);

					Method method6 = newModelClass.getMethod("setRasi",
							new Class[] { String.class });

					String value6 = oldCplModel.getRasi();

					method6.invoke(newModel, value6);

					Method method7 = newModelClass.getMethod("setStar",
							new Class[] { String.class });

					String value7 = oldCplModel.getStar();

					method7.invoke(newModel, value7);

					Method method8 = newModelClass.getMethod("setDosam",
							new Class[] { String.class });

					String value8 = oldCplModel.getDosam();

					method8.invoke(newModel, value8);

					Method method9 = newModelClass.getMethod("setReligion",
							new Class[] { String.class });

					String value9 = oldCplModel.getReligion();

					method9.invoke(newModel, value9);

					Method method10 = newModelClass.getMethod("setCaste",
							new Class[] { String.class });

					String value10 = oldCplModel.getCaste();

					method10.invoke(newModel, value10);

					Method method11 = newModelClass.getMethod("setSubcaste",
							new Class[] { String.class });

					String value11 = oldCplModel.getSubcaste();

					method11.invoke(newModel, value11);

					Method method12 = newModelClass.getMethod("setHeight",
							new Class[] { String.class });

					String value12 = oldCplModel.getHeight();

					method12.invoke(newModel, value12);

					Method method13 = newModelClass.getMethod("setWeight",
							new Class[] { String.class });

					String value13 = oldCplModel.getWeight();

					method13.invoke(newModel, value13);

					Method method14 = newModelClass.getMethod("setComplexion",
							new Class[] { String.class });

					String value14 = oldCplModel.getComplexion();

					method14.invoke(newModel, value14);

					Method method15 = newModelClass.getMethod("setMotherTongue",
							new Class[] { String.class });

					String value15 = oldCplModel.getMotherTongue();

					method15.invoke(newModel, value15);

					Method method16 = newModelClass.getMethod("setLanguageKnown",
							new Class[] { String.class });

					String value16 = oldCplModel.getLanguageKnown();

					method16.invoke(newModel, value16);

					Method method17 = newModelClass.getMethod("setMaritalStatus",
							new Class[] { String.class });

					String value17 = oldCplModel.getMaritalStatus();

					method17.invoke(newModel, value17);

					Method method18 = newModelClass.getMethod("setChildren",
							new Class[] { Integer.TYPE });

					Integer value18 = new Integer(oldCplModel.getChildren());

					method18.invoke(newModel, value18);

					Method method19 = newModelClass.getMethod("setResidingCountry",
							new Class[] { String.class });

					String value19 = oldCplModel.getResidingCountry();

					method19.invoke(newModel, value19);

					Method method20 = newModelClass.getMethod("setResidingState",
							new Class[] { String.class });

					String value20 = oldCplModel.getResidingState();

					method20.invoke(newModel, value20);

					Method method21 = newModelClass.getMethod("setResidingCity",
							new Class[] { String.class });

					String value21 = oldCplModel.getResidingCity();

					method21.invoke(newModel, value21);

					Method method22 = newModelClass.getMethod("setAddress",
							new Class[] { String.class });

					String value22 = oldCplModel.getAddress();

					method22.invoke(newModel, value22);

					Method method23 = newModelClass.getMethod("setPostalCode",
							new Class[] { String.class });

					String value23 = oldCplModel.getPostalCode();

					method23.invoke(newModel, value23);

					Method method24 = newModelClass.getMethod("setHomePhone",
							new Class[] { String.class });

					String value24 = oldCplModel.getHomePhone();

					method24.invoke(newModel, value24);

					Method method25 = newModelClass.getMethod("setMobile",
							new Class[] { String.class });

					String value25 = oldCplModel.getMobile();

					method25.invoke(newModel, value25);

					Method method26 = newModelClass.getMethod("setEmailAddress",
							new Class[] { String.class });

					String value26 = oldCplModel.getEmailAddress();

					method26.invoke(newModel, value26);

					Method method27 = newModelClass.getMethod("setEducation",
							new Class[] { String.class });

					String value27 = oldCplModel.getEducation();

					method27.invoke(newModel, value27);

					Method method28 = newModelClass.getMethod("setProfession",
							new Class[] { String.class });

					String value28 = oldCplModel.getProfession();

					method28.invoke(newModel, value28);

					Method method29 = newModelClass.getMethod("setCurrency",
							new Class[] { String.class });

					String value29 = oldCplModel.getCurrency();

					method29.invoke(newModel, value29);

					Method method30 = newModelClass.getMethod("setAnnualIncome",
							new Class[] { String.class });

					String value30 = oldCplModel.getAnnualIncome();

					method30.invoke(newModel, value30);

					Method method31 = newModelClass.getMethod("setHobbies",
							new Class[] { String.class });

					String value31 = oldCplModel.getHobbies();

					method31.invoke(newModel, value31);

					Method method32 = newModelClass.getMethod("setAboutMe",
							new Class[] { String.class });

					String value32 = oldCplModel.getAboutMe();

					method32.invoke(newModel, value32);

					Method method33 = newModelClass.getMethod("setFamilyValue",
							new Class[] { String.class });

					String value33 = oldCplModel.getFamilyValue();

					method33.invoke(newModel, value33);

					Method method34 = newModelClass.getMethod("setFamilyType",
							new Class[] { String.class });

					String value34 = oldCplModel.getFamilyType();

					method34.invoke(newModel, value34);

					Method method35 = newModelClass.getMethod("setFamilyStatus",
							new Class[] { String.class });

					String value35 = oldCplModel.getFamilyStatus();

					method35.invoke(newModel, value35);

					Method method36 = newModelClass.getMethod("setSecurityNo1",
							new Class[] { String.class });

					String value36 = oldCplModel.getSecurityNo1();

					method36.invoke(newModel, value36);

					Method method37 = newModelClass.getMethod("setSecurityNo2",
							new Class[] { String.class });

					String value37 = oldCplModel.getSecurityNo2();

					method37.invoke(newModel, value37);

					Method method38 = newModelClass.getMethod("setPhotoSecurityCode",
							new Class[] { String.class });

					String value38 = oldCplModel.getPhotoSecurityCode();

					method38.invoke(newModel, value38);

					Method method39 = newModelClass.getMethod("setLastLoggedIn",
							new Class[] { Date.class });

					Date value39 = oldCplModel.getLastLoggedIn();

					method39.invoke(newModel, value39);

					Method method40 = newModelClass.getMethod("setStatus",
							new Class[] { Integer.TYPE });

					Integer value40 = new Integer(oldCplModel.getStatus());

					method40.invoke(newModel, value40);

					Method method41 = newModelClass.getMethod("setAge",
							new Class[] { Integer.TYPE });

					Integer value41 = new Integer(oldCplModel.getAge());

					method41.invoke(newModel, value41);

					Method method42 = newModelClass.getMethod("setScheme",
							new Class[] { Integer.TYPE });

					Integer value42 = new Integer(oldCplModel.getScheme());

					method42.invoke(newModel, value42);

					Method method43 = newModelClass.getMethod("setHoroscope",
							new Class[] { Boolean.TYPE });

					Boolean value43 = new Boolean(oldCplModel.getHoroscope());

					method43.invoke(newModel, value43);

					Method method44 = newModelClass.getMethod("setAddedBy",
							new Class[] { Long.TYPE });

					Long value44 = new Long(oldCplModel.getAddedBy());

					method44.invoke(newModel, value44);

					Method method45 = newModelClass.getMethod("setDateAdded",
							new Class[] { Date.class });

					Date value45 = oldCplModel.getDateAdded();

					method45.invoke(newModel, value45);

					Method method46 = newModelClass.getMethod("setDateModified",
							new Class[] { Date.class });

					Date value46 = oldCplModel.getDateModified();

					method46.invoke(newModel, value46);

					Method method47 = newModelClass.getMethod("setModifiedBy",
							new Class[] { Long.TYPE });

					Long value47 = new Long(oldCplModel.getModifiedBy());

					method47.invoke(newModel, value47);

					Method method48 = newModelClass.getMethod("setModifiedCount",
							new Class[] { Integer.TYPE });

					Integer value48 = new Integer(oldCplModel.getModifiedCount());

					method48.invoke(newModel, value48);

					Method method49 = newModelClass.getMethod("setCompanyId",
							new Class[] { Long.TYPE });

					Long value49 = new Long(oldCplModel.getCompanyId());

					method49.invoke(newModel, value49);

					Method method50 = newModelClass.getMethod("setGroupId",
							new Class[] { Long.TYPE });

					Long value50 = new Long(oldCplModel.getGroupId());

					method50.invoke(newModel, value50);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(MyExpectationClp.class.getName())) {
			MyExpectationClp oldCplModel = (MyExpectationClp)oldModel;

			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					Class<?> newModelClass = Class.forName("com.vijayan.profile.model.impl.MyExpectationImpl",
							true, _classLoader);

					Object newModel = newModelClass.newInstance();

					Method method0 = newModelClass.getMethod("setExceptationId",
							new Class[] { Long.TYPE });

					Long value0 = new Long(oldCplModel.getExceptationId());

					method0.invoke(newModel, value0);

					Method method1 = newModelClass.getMethod("setProfileId",
							new Class[] { Long.TYPE });

					Long value1 = new Long(oldCplModel.getProfileId());

					method1.invoke(newModel, value1);

					Method method2 = newModelClass.getMethod("setMinAge",
							new Class[] { Integer.TYPE });

					Integer value2 = new Integer(oldCplModel.getMinAge());

					method2.invoke(newModel, value2);

					Method method3 = newModelClass.getMethod("setMaxAge",
							new Class[] { Integer.TYPE });

					Integer value3 = new Integer(oldCplModel.getMaxAge());

					method3.invoke(newModel, value3);

					Method method4 = newModelClass.getMethod("setExpectedReligion",
							new Class[] { String.class });

					String value4 = oldCplModel.getExpectedReligion();

					method4.invoke(newModel, value4);

					Method method5 = newModelClass.getMethod("setExpectedCaste",
							new Class[] { String.class });

					String value5 = oldCplModel.getExpectedCaste();

					method5.invoke(newModel, value5);

					Method method6 = newModelClass.getMethod("setExpectedSubCaste",
							new Class[] { String.class });

					String value6 = oldCplModel.getExpectedSubCaste();

					method6.invoke(newModel, value6);

					Method method7 = newModelClass.getMethod("setExpectedCountry",
							new Class[] { String.class });

					String value7 = oldCplModel.getExpectedCountry();

					method7.invoke(newModel, value7);

					Method method8 = newModelClass.getMethod("setExpectedState",
							new Class[] { String.class });

					String value8 = oldCplModel.getExpectedState();

					method8.invoke(newModel, value8);

					Method method9 = newModelClass.getMethod("setExpectedCity",
							new Class[] { String.class });

					String value9 = oldCplModel.getExpectedCity();

					method9.invoke(newModel, value9);

					Method method10 = newModelClass.getMethod("setExpectedHeight",
							new Class[] { String.class });

					String value10 = oldCplModel.getExpectedHeight();

					method10.invoke(newModel, value10);

					Method method11 = newModelClass.getMethod("setExpectedWeight",
							new Class[] { String.class });

					String value11 = oldCplModel.getExpectedWeight();

					method11.invoke(newModel, value11);

					Method method12 = newModelClass.getMethod("setExpectedComplexion",
							new Class[] { String.class });

					String value12 = oldCplModel.getExpectedComplexion();

					method12.invoke(newModel, value12);

					Method method13 = newModelClass.getMethod("setExpectedLanguage",
							new Class[] { String.class });

					String value13 = oldCplModel.getExpectedLanguage();

					method13.invoke(newModel, value13);

					Method method14 = newModelClass.getMethod("setExpectedMaritalStatus",
							new Class[] { String.class });

					String value14 = oldCplModel.getExpectedMaritalStatus();

					method14.invoke(newModel, value14);

					Method method15 = newModelClass.getMethod("setExpectationDetail",
							new Class[] { String.class });

					String value15 = oldCplModel.getExpectationDetail();

					method15.invoke(newModel, value15);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(FamilyMemberClp.class.getName())) {
			FamilyMemberClp oldCplModel = (FamilyMemberClp)oldModel;

			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					Class<?> newModelClass = Class.forName("com.vijayan.profile.model.impl.FamilyMemberImpl",
							true, _classLoader);

					Object newModel = newModelClass.newInstance();

					Method method0 = newModelClass.getMethod("setMemberId",
							new Class[] { Long.TYPE });

					Long value0 = new Long(oldCplModel.getMemberId());

					method0.invoke(newModel, value0);

					Method method1 = newModelClass.getMethod("setProfileId",
							new Class[] { Long.TYPE });

					Long value1 = new Long(oldCplModel.getProfileId());

					method1.invoke(newModel, value1);

					Method method2 = newModelClass.getMethod("setMemberName",
							new Class[] { String.class });

					String value2 = oldCplModel.getMemberName();

					method2.invoke(newModel, value2);

					Method method3 = newModelClass.getMethod("setRelationship",
							new Class[] { String.class });

					String value3 = oldCplModel.getRelationship();

					method3.invoke(newModel, value3);

					Method method4 = newModelClass.getMethod("setMarried",
							new Class[] { Boolean.TYPE });

					Boolean value4 = new Boolean(oldCplModel.getMarried());

					method4.invoke(newModel, value4);

					Method method5 = newModelClass.getMethod("setAvailable",
							new Class[] { Boolean.TYPE });

					Boolean value5 = new Boolean(oldCplModel.getAvailable());

					method5.invoke(newModel, value5);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(HoroscopeClp.class.getName())) {
			HoroscopeClp oldCplModel = (HoroscopeClp)oldModel;

			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					Class<?> newModelClass = Class.forName("com.vijayan.profile.model.impl.HoroscopeImpl",
							true, _classLoader);

					Object newModel = newModelClass.newInstance();

					Method method0 = newModelClass.getMethod("setHoroscopeId",
							new Class[] { Long.TYPE });

					Long value0 = new Long(oldCplModel.getHoroscopeId());

					method0.invoke(newModel, value0);

					Method method1 = newModelClass.getMethod("setProfileId",
							new Class[] { Long.TYPE });

					Long value1 = new Long(oldCplModel.getProfileId());

					method1.invoke(newModel, value1);

					Method method2 = newModelClass.getMethod("setSuryan",
							new Class[] { Integer.TYPE });

					Integer value2 = new Integer(oldCplModel.getSuryan());

					method2.invoke(newModel, value2);

					Method method3 = newModelClass.getMethod("setChandra",
							new Class[] { Integer.TYPE });

					Integer value3 = new Integer(oldCplModel.getChandra());

					method3.invoke(newModel, value3);

					Method method4 = newModelClass.getMethod("setKuja",
							new Class[] { Integer.TYPE });

					Integer value4 = new Integer(oldCplModel.getKuja());

					method4.invoke(newModel, value4);

					Method method5 = newModelClass.getMethod("setBudha",
							new Class[] { Integer.TYPE });

					Integer value5 = new Integer(oldCplModel.getBudha());

					method5.invoke(newModel, value5);

					Method method6 = newModelClass.getMethod("setGuru",
							new Class[] { Integer.TYPE });

					Integer value6 = new Integer(oldCplModel.getGuru());

					method6.invoke(newModel, value6);

					Method method7 = newModelClass.getMethod("setSukra",
							new Class[] { Integer.TYPE });

					Integer value7 = new Integer(oldCplModel.getSukra());

					method7.invoke(newModel, value7);

					Method method8 = newModelClass.getMethod("setSani",
							new Class[] { Integer.TYPE });

					Integer value8 = new Integer(oldCplModel.getSani());

					method8.invoke(newModel, value8);

					Method method9 = newModelClass.getMethod("setRahu",
							new Class[] { Integer.TYPE });

					Integer value9 = new Integer(oldCplModel.getRahu());

					method9.invoke(newModel, value9);

					Method method10 = newModelClass.getMethod("setKetu",
							new Class[] { Integer.TYPE });

					Integer value10 = new Integer(oldCplModel.getKetu());

					method10.invoke(newModel, value10);

					Method method11 = newModelClass.getMethod("setMandhi",
							new Class[] { Integer.TYPE });

					Integer value11 = new Integer(oldCplModel.getMandhi());

					method11.invoke(newModel, value11);

					Method method12 = newModelClass.getMethod("setLagna",
							new Class[] { Integer.TYPE });

					Integer value12 = new Integer(oldCplModel.getLagna());

					method12.invoke(newModel, value12);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(MyPhotoClp.class.getName())) {
			MyPhotoClp oldCplModel = (MyPhotoClp)oldModel;

			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					Class<?> newModelClass = Class.forName("com.vijayan.profile.model.impl.MyPhotoImpl",
							true, _classLoader);

					Object newModel = newModelClass.newInstance();

					Method method0 = newModelClass.getMethod("setPhotoId",
							new Class[] { Long.TYPE });

					Long value0 = new Long(oldCplModel.getPhotoId());

					method0.invoke(newModel, value0);

					Method method1 = newModelClass.getMethod("setProfileId",
							new Class[] { Long.TYPE });

					Long value1 = new Long(oldCplModel.getProfileId());

					method1.invoke(newModel, value1);

					Method method2 = newModelClass.getMethod("setContent",
							new Class[] { String.class });

					String value2 = oldCplModel.getContent();

					method2.invoke(newModel, value2);

					Method method3 = newModelClass.getMethod("setWidth",
							new Class[] { Integer.TYPE });

					Integer value3 = new Integer(oldCplModel.getWidth());

					method3.invoke(newModel, value3);

					Method method4 = newModelClass.getMethod("setHeight",
							new Class[] { Integer.TYPE });

					Integer value4 = new Integer(oldCplModel.getHeight());

					method4.invoke(newModel, value4);

					Method method5 = newModelClass.getMethod("setType",
							new Class[] { String.class });

					String value5 = oldCplModel.getType();

					method5.invoke(newModel, value5);

					Method method6 = newModelClass.getMethod("setThumbnail",
							new Class[] { Boolean.TYPE });

					Boolean value6 = new Boolean(oldCplModel.getThumbnail());

					method6.invoke(newModel, value6);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		return oldModel;
	}

	public static Object translateInput(List<Object> oldList) {
		List<Object> newList = new ArrayList<Object>(oldList.size());

		for (int i = 0; i < oldList.size(); i++) {
			Object curObj = oldList.get(i);

			newList.add(translateInput(curObj));
		}

		return newList;
	}

	public static Object translateInput(Object obj) {
		if (obj instanceof BaseModel<?>) {
			return translateInput((BaseModel<?>)obj);
		}
		else if (obj instanceof List<?>) {
			return translateInput((List<Object>)obj);
		}
		else {
			return obj;
		}
	}

	public static Object translateOutput(BaseModel<?> oldModel) {
		Class<?> oldModelClass = oldModel.getClass();

		String oldModelClassName = oldModelClass.getName();

		if (oldModelClassName.equals(
					"com.vijayan.profile.model.impl.ProfileImpl")) {
			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					ProfileClp newModel = new ProfileClp();

					Method method0 = oldModelClass.getMethod("getProfileId");

					Long value0 = (Long)method0.invoke(oldModel, (Object[])null);

					newModel.setProfileId(value0);

					Method method1 = oldModelClass.getMethod("getProfileCode");

					String value1 = (String)method1.invoke(oldModel,
							(Object[])null);

					newModel.setProfileCode(value1);

					Method method2 = oldModelClass.getMethod("getCreatedForMy");

					String value2 = (String)method2.invoke(oldModel,
							(Object[])null);

					newModel.setCreatedForMy(value2);

					Method method3 = oldModelClass.getMethod("getProfileName");

					String value3 = (String)method3.invoke(oldModel,
							(Object[])null);

					newModel.setProfileName(value3);

					Method method4 = oldModelClass.getMethod("getGender");

					Boolean value4 = (Boolean)method4.invoke(oldModel,
							(Object[])null);

					newModel.setGender(value4);

					Method method5 = oldModelClass.getMethod(
							"getBirthDateWithTime");

					Date value5 = (Date)method5.invoke(oldModel, (Object[])null);

					newModel.setBirthDateWithTime(value5);

					Method method6 = oldModelClass.getMethod("getRasi");

					String value6 = (String)method6.invoke(oldModel,
							(Object[])null);

					newModel.setRasi(value6);

					Method method7 = oldModelClass.getMethod("getStar");

					String value7 = (String)method7.invoke(oldModel,
							(Object[])null);

					newModel.setStar(value7);

					Method method8 = oldModelClass.getMethod("getDosam");

					String value8 = (String)method8.invoke(oldModel,
							(Object[])null);

					newModel.setDosam(value8);

					Method method9 = oldModelClass.getMethod("getReligion");

					String value9 = (String)method9.invoke(oldModel,
							(Object[])null);

					newModel.setReligion(value9);

					Method method10 = oldModelClass.getMethod("getCaste");

					String value10 = (String)method10.invoke(oldModel,
							(Object[])null);

					newModel.setCaste(value10);

					Method method11 = oldModelClass.getMethod("getSubcaste");

					String value11 = (String)method11.invoke(oldModel,
							(Object[])null);

					newModel.setSubcaste(value11);

					Method method12 = oldModelClass.getMethod("getHeight");

					String value12 = (String)method12.invoke(oldModel,
							(Object[])null);

					newModel.setHeight(value12);

					Method method13 = oldModelClass.getMethod("getWeight");

					String value13 = (String)method13.invoke(oldModel,
							(Object[])null);

					newModel.setWeight(value13);

					Method method14 = oldModelClass.getMethod("getComplexion");

					String value14 = (String)method14.invoke(oldModel,
							(Object[])null);

					newModel.setComplexion(value14);

					Method method15 = oldModelClass.getMethod("getMotherTongue");

					String value15 = (String)method15.invoke(oldModel,
							(Object[])null);

					newModel.setMotherTongue(value15);

					Method method16 = oldModelClass.getMethod(
							"getLanguageKnown");

					String value16 = (String)method16.invoke(oldModel,
							(Object[])null);

					newModel.setLanguageKnown(value16);

					Method method17 = oldModelClass.getMethod(
							"getMaritalStatus");

					String value17 = (String)method17.invoke(oldModel,
							(Object[])null);

					newModel.setMaritalStatus(value17);

					Method method18 = oldModelClass.getMethod("getChildren");

					Integer value18 = (Integer)method18.invoke(oldModel,
							(Object[])null);

					newModel.setChildren(value18);

					Method method19 = oldModelClass.getMethod(
							"getResidingCountry");

					String value19 = (String)method19.invoke(oldModel,
							(Object[])null);

					newModel.setResidingCountry(value19);

					Method method20 = oldModelClass.getMethod(
							"getResidingState");

					String value20 = (String)method20.invoke(oldModel,
							(Object[])null);

					newModel.setResidingState(value20);

					Method method21 = oldModelClass.getMethod("getResidingCity");

					String value21 = (String)method21.invoke(oldModel,
							(Object[])null);

					newModel.setResidingCity(value21);

					Method method22 = oldModelClass.getMethod("getAddress");

					String value22 = (String)method22.invoke(oldModel,
							(Object[])null);

					newModel.setAddress(value22);

					Method method23 = oldModelClass.getMethod("getPostalCode");

					String value23 = (String)method23.invoke(oldModel,
							(Object[])null);

					newModel.setPostalCode(value23);

					Method method24 = oldModelClass.getMethod("getHomePhone");

					String value24 = (String)method24.invoke(oldModel,
							(Object[])null);

					newModel.setHomePhone(value24);

					Method method25 = oldModelClass.getMethod("getMobile");

					String value25 = (String)method25.invoke(oldModel,
							(Object[])null);

					newModel.setMobile(value25);

					Method method26 = oldModelClass.getMethod("getEmailAddress");

					String value26 = (String)method26.invoke(oldModel,
							(Object[])null);

					newModel.setEmailAddress(value26);

					Method method27 = oldModelClass.getMethod("getEducation");

					String value27 = (String)method27.invoke(oldModel,
							(Object[])null);

					newModel.setEducation(value27);

					Method method28 = oldModelClass.getMethod("getProfession");

					String value28 = (String)method28.invoke(oldModel,
							(Object[])null);

					newModel.setProfession(value28);

					Method method29 = oldModelClass.getMethod("getCurrency");

					String value29 = (String)method29.invoke(oldModel,
							(Object[])null);

					newModel.setCurrency(value29);

					Method method30 = oldModelClass.getMethod("getAnnualIncome");

					String value30 = (String)method30.invoke(oldModel,
							(Object[])null);

					newModel.setAnnualIncome(value30);

					Method method31 = oldModelClass.getMethod("getHobbies");

					String value31 = (String)method31.invoke(oldModel,
							(Object[])null);

					newModel.setHobbies(value31);

					Method method32 = oldModelClass.getMethod("getAboutMe");

					String value32 = (String)method32.invoke(oldModel,
							(Object[])null);

					newModel.setAboutMe(value32);

					Method method33 = oldModelClass.getMethod("getFamilyValue");

					String value33 = (String)method33.invoke(oldModel,
							(Object[])null);

					newModel.setFamilyValue(value33);

					Method method34 = oldModelClass.getMethod("getFamilyType");

					String value34 = (String)method34.invoke(oldModel,
							(Object[])null);

					newModel.setFamilyType(value34);

					Method method35 = oldModelClass.getMethod("getFamilyStatus");

					String value35 = (String)method35.invoke(oldModel,
							(Object[])null);

					newModel.setFamilyStatus(value35);

					Method method36 = oldModelClass.getMethod("getSecurityNo1");

					String value36 = (String)method36.invoke(oldModel,
							(Object[])null);

					newModel.setSecurityNo1(value36);

					Method method37 = oldModelClass.getMethod("getSecurityNo2");

					String value37 = (String)method37.invoke(oldModel,
							(Object[])null);

					newModel.setSecurityNo2(value37);

					Method method38 = oldModelClass.getMethod(
							"getPhotoSecurityCode");

					String value38 = (String)method38.invoke(oldModel,
							(Object[])null);

					newModel.setPhotoSecurityCode(value38);

					Method method39 = oldModelClass.getMethod("getLastLoggedIn");

					Date value39 = (Date)method39.invoke(oldModel,
							(Object[])null);

					newModel.setLastLoggedIn(value39);

					Method method40 = oldModelClass.getMethod("getStatus");

					Integer value40 = (Integer)method40.invoke(oldModel,
							(Object[])null);

					newModel.setStatus(value40);

					Method method41 = oldModelClass.getMethod("getAge");

					Integer value41 = (Integer)method41.invoke(oldModel,
							(Object[])null);

					newModel.setAge(value41);

					Method method42 = oldModelClass.getMethod("getScheme");

					Integer value42 = (Integer)method42.invoke(oldModel,
							(Object[])null);

					newModel.setScheme(value42);

					Method method43 = oldModelClass.getMethod("getHoroscope");

					Boolean value43 = (Boolean)method43.invoke(oldModel,
							(Object[])null);

					newModel.setHoroscope(value43);

					Method method44 = oldModelClass.getMethod("getAddedBy");

					Long value44 = (Long)method44.invoke(oldModel,
							(Object[])null);

					newModel.setAddedBy(value44);

					Method method45 = oldModelClass.getMethod("getDateAdded");

					Date value45 = (Date)method45.invoke(oldModel,
							(Object[])null);

					newModel.setDateAdded(value45);

					Method method46 = oldModelClass.getMethod("getDateModified");

					Date value46 = (Date)method46.invoke(oldModel,
							(Object[])null);

					newModel.setDateModified(value46);

					Method method47 = oldModelClass.getMethod("getModifiedBy");

					Long value47 = (Long)method47.invoke(oldModel,
							(Object[])null);

					newModel.setModifiedBy(value47);

					Method method48 = oldModelClass.getMethod(
							"getModifiedCount");

					Integer value48 = (Integer)method48.invoke(oldModel,
							(Object[])null);

					newModel.setModifiedCount(value48);

					Method method49 = oldModelClass.getMethod("getCompanyId");

					Long value49 = (Long)method49.invoke(oldModel,
							(Object[])null);

					newModel.setCompanyId(value49);

					Method method50 = oldModelClass.getMethod("getGroupId");

					Long value50 = (Long)method50.invoke(oldModel,
							(Object[])null);

					newModel.setGroupId(value50);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(
					"com.vijayan.profile.model.impl.MyExpectationImpl")) {
			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					MyExpectationClp newModel = new MyExpectationClp();

					Method method0 = oldModelClass.getMethod("getExceptationId");

					Long value0 = (Long)method0.invoke(oldModel, (Object[])null);

					newModel.setExceptationId(value0);

					Method method1 = oldModelClass.getMethod("getProfileId");

					Long value1 = (Long)method1.invoke(oldModel, (Object[])null);

					newModel.setProfileId(value1);

					Method method2 = oldModelClass.getMethod("getMinAge");

					Integer value2 = (Integer)method2.invoke(oldModel,
							(Object[])null);

					newModel.setMinAge(value2);

					Method method3 = oldModelClass.getMethod("getMaxAge");

					Integer value3 = (Integer)method3.invoke(oldModel,
							(Object[])null);

					newModel.setMaxAge(value3);

					Method method4 = oldModelClass.getMethod(
							"getExpectedReligion");

					String value4 = (String)method4.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedReligion(value4);

					Method method5 = oldModelClass.getMethod("getExpectedCaste");

					String value5 = (String)method5.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedCaste(value5);

					Method method6 = oldModelClass.getMethod(
							"getExpectedSubCaste");

					String value6 = (String)method6.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedSubCaste(value6);

					Method method7 = oldModelClass.getMethod(
							"getExpectedCountry");

					String value7 = (String)method7.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedCountry(value7);

					Method method8 = oldModelClass.getMethod("getExpectedState");

					String value8 = (String)method8.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedState(value8);

					Method method9 = oldModelClass.getMethod("getExpectedCity");

					String value9 = (String)method9.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedCity(value9);

					Method method10 = oldModelClass.getMethod(
							"getExpectedHeight");

					String value10 = (String)method10.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedHeight(value10);

					Method method11 = oldModelClass.getMethod(
							"getExpectedWeight");

					String value11 = (String)method11.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedWeight(value11);

					Method method12 = oldModelClass.getMethod(
							"getExpectedComplexion");

					String value12 = (String)method12.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedComplexion(value12);

					Method method13 = oldModelClass.getMethod(
							"getExpectedLanguage");

					String value13 = (String)method13.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedLanguage(value13);

					Method method14 = oldModelClass.getMethod(
							"getExpectedMaritalStatus");

					String value14 = (String)method14.invoke(oldModel,
							(Object[])null);

					newModel.setExpectedMaritalStatus(value14);

					Method method15 = oldModelClass.getMethod(
							"getExpectationDetail");

					String value15 = (String)method15.invoke(oldModel,
							(Object[])null);

					newModel.setExpectationDetail(value15);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(
					"com.vijayan.profile.model.impl.FamilyMemberImpl")) {
			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					FamilyMemberClp newModel = new FamilyMemberClp();

					Method method0 = oldModelClass.getMethod("getMemberId");

					Long value0 = (Long)method0.invoke(oldModel, (Object[])null);

					newModel.setMemberId(value0);

					Method method1 = oldModelClass.getMethod("getProfileId");

					Long value1 = (Long)method1.invoke(oldModel, (Object[])null);

					newModel.setProfileId(value1);

					Method method2 = oldModelClass.getMethod("getMemberName");

					String value2 = (String)method2.invoke(oldModel,
							(Object[])null);

					newModel.setMemberName(value2);

					Method method3 = oldModelClass.getMethod("getRelationship");

					String value3 = (String)method3.invoke(oldModel,
							(Object[])null);

					newModel.setRelationship(value3);

					Method method4 = oldModelClass.getMethod("getMarried");

					Boolean value4 = (Boolean)method4.invoke(oldModel,
							(Object[])null);

					newModel.setMarried(value4);

					Method method5 = oldModelClass.getMethod("getAvailable");

					Boolean value5 = (Boolean)method5.invoke(oldModel,
							(Object[])null);

					newModel.setAvailable(value5);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(
					"com.vijayan.profile.model.impl.HoroscopeImpl")) {
			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					HoroscopeClp newModel = new HoroscopeClp();

					Method method0 = oldModelClass.getMethod("getHoroscopeId");

					Long value0 = (Long)method0.invoke(oldModel, (Object[])null);

					newModel.setHoroscopeId(value0);

					Method method1 = oldModelClass.getMethod("getProfileId");

					Long value1 = (Long)method1.invoke(oldModel, (Object[])null);

					newModel.setProfileId(value1);

					Method method2 = oldModelClass.getMethod("getSuryan");

					Integer value2 = (Integer)method2.invoke(oldModel,
							(Object[])null);

					newModel.setSuryan(value2);

					Method method3 = oldModelClass.getMethod("getChandra");

					Integer value3 = (Integer)method3.invoke(oldModel,
							(Object[])null);

					newModel.setChandra(value3);

					Method method4 = oldModelClass.getMethod("getKuja");

					Integer value4 = (Integer)method4.invoke(oldModel,
							(Object[])null);

					newModel.setKuja(value4);

					Method method5 = oldModelClass.getMethod("getBudha");

					Integer value5 = (Integer)method5.invoke(oldModel,
							(Object[])null);

					newModel.setBudha(value5);

					Method method6 = oldModelClass.getMethod("getGuru");

					Integer value6 = (Integer)method6.invoke(oldModel,
							(Object[])null);

					newModel.setGuru(value6);

					Method method7 = oldModelClass.getMethod("getSukra");

					Integer value7 = (Integer)method7.invoke(oldModel,
							(Object[])null);

					newModel.setSukra(value7);

					Method method8 = oldModelClass.getMethod("getSani");

					Integer value8 = (Integer)method8.invoke(oldModel,
							(Object[])null);

					newModel.setSani(value8);

					Method method9 = oldModelClass.getMethod("getRahu");

					Integer value9 = (Integer)method9.invoke(oldModel,
							(Object[])null);

					newModel.setRahu(value9);

					Method method10 = oldModelClass.getMethod("getKetu");

					Integer value10 = (Integer)method10.invoke(oldModel,
							(Object[])null);

					newModel.setKetu(value10);

					Method method11 = oldModelClass.getMethod("getMandhi");

					Integer value11 = (Integer)method11.invoke(oldModel,
							(Object[])null);

					newModel.setMandhi(value11);

					Method method12 = oldModelClass.getMethod("getLagna");

					Integer value12 = (Integer)method12.invoke(oldModel,
							(Object[])null);

					newModel.setLagna(value12);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		if (oldModelClassName.equals(
					"com.vijayan.profile.model.impl.MyPhotoImpl")) {
			ClassLoader contextClassLoader = Thread.currentThread()
												   .getContextClassLoader();

			try {
				Thread.currentThread().setContextClassLoader(_classLoader);

				try {
					MyPhotoClp newModel = new MyPhotoClp();

					Method method0 = oldModelClass.getMethod("getPhotoId");

					Long value0 = (Long)method0.invoke(oldModel, (Object[])null);

					newModel.setPhotoId(value0);

					Method method1 = oldModelClass.getMethod("getProfileId");

					Long value1 = (Long)method1.invoke(oldModel, (Object[])null);

					newModel.setProfileId(value1);

					Method method2 = oldModelClass.getMethod("getContent");

					String value2 = (String)method2.invoke(oldModel,
							(Object[])null);

					newModel.setContent(value2);

					Method method3 = oldModelClass.getMethod("getWidth");

					Integer value3 = (Integer)method3.invoke(oldModel,
							(Object[])null);

					newModel.setWidth(value3);

					Method method4 = oldModelClass.getMethod("getHeight");

					Integer value4 = (Integer)method4.invoke(oldModel,
							(Object[])null);

					newModel.setHeight(value4);

					Method method5 = oldModelClass.getMethod("getType");

					String value5 = (String)method5.invoke(oldModel,
							(Object[])null);

					newModel.setType(value5);

					Method method6 = oldModelClass.getMethod("getThumbnail");

					Boolean value6 = (Boolean)method6.invoke(oldModel,
							(Object[])null);

					newModel.setThumbnail(value6);

					return newModel;
				}
				catch (Exception e) {
					_log.error(e, e);
				}
			}
			finally {
				Thread.currentThread().setContextClassLoader(contextClassLoader);
			}
		}

		return oldModel;
	}

	public static Object translateOutput(List<Object> oldList) {
		List<Object> newList = new ArrayList<Object>(oldList.size());

		for (int i = 0; i < oldList.size(); i++) {
			Object curObj = oldList.get(i);

			newList.add(translateOutput(curObj));
		}

		return newList;
	}

	public static Object translateOutput(Object obj) {
		if (obj instanceof BaseModel<?>) {
			return translateOutput((BaseModel<?>)obj);
		}
		else if (obj instanceof List<?>) {
			return translateOutput((List<Object>)obj);
		}
		else {
			return obj;
		}
	}

	private static Log _log = LogFactoryUtil.getLog(ClpSerializer.class);
	private static ClassLoader _classLoader;
}